<template>
	<view class="all">
		<view class="list">
			<view class="item" v-for="(item,index) in data" :key="index" @click="go(item)">
				<view class="left">
					<view class="name">{{ item.title }}</view>
					<view class="time">创建时间：{{ item.createTime }}</view>
				</view>
				<view class="right">
					<u--image :showLoading="true" :src="item.images" width="80px" height="80px" @click="click">
					</u--image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: []
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init() {
				this.$u.http.get("/app/paper/reallyList").then(res => {
					console.log(res.data);

					this.data = res.data

				})
			},
			go(item) {

				uni.showModal({
					title: '确定前往测试',
					
					showCancel: true,
					success: function(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: '../../user/exam/format?id='+item.id
							})	
						} else if (res.cancel) {
							uni.showToast({
								icon: 'none',
								title: '已取消'
							})
						}
					}
				})

			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: linear-gradient(180deg, #FFFFFF 0%, #F5F5F5 100%);
		background-attachment: fixed;
	}

	.list {
		width: 100%;
		background: #FFFFFF;
		margin-top: 20px;
		padding-bottom: 20px;

		.item {
			width: 90%;
			margin: 0 20px;
			display: flex;
			align-items: center;
			padding: 10px 0;
			border-bottom: 1upx solid #eee;
			justify-content: space-around;

			.left {
				width: 90%;
				box-sizing: border-box;

				.time {
					font-size: 12px;
					color: #888888;
					line-height: 18px;
				}
			}


		}
	}
</style>
